﻿@{
    ViewBag.Title = "品名选择";
    Layout = "~/Views/Shared/_LayoutList.cshtml"; 
}
@(       
 Html.DWZGridFor<Material>()
    .ID("gridList")
    .Title("品名选择")
    .Action(@Url.Action("MaterialList"))
    .Height("document.documentElement.clientHeight-86")
    .Width(838)
    .Height(288)
    .Columns(col =>
    {
        col.Bind(e => e.Id).IsKey();
        col.Bind(e => e.Code).Width(60).AsQuery();
        col.Bind(e => e.Name).Width(60).AsQuery().Align(FlexiGridAlign.Left);
        col.Bind(e => e.CurrentPrice).Width(60).Align(FlexiGridAlign.Right);
        col.Bind(e => e.Type).Width(60).EnumKey("MaterialType");
        col.Bind(e => e.Category).Width(80).EnumKey("MaterialCategory");
        col.Bind(e => e.Specification).Width(60).EnumKey("MaterialSpec");
        col.Bind(e => e.Unit).Width(60).EnumKey("MaterialUnit");
        col.Bind(e => e.ActualSorage).Width(50).Align(FlexiGridAlign.Right);
        col.Bind(e => e.SafeStorage).Width(50).Align(FlexiGridAlign.Right);
        col.Bind(e => e.RawMaterialId).EnumKey("Material");
        col.Bind(e => e.ProcessRate).Width(40).Align(FlexiGridAlign.Right);
    })
    .Buttons(btn =>
    {
        btn.Bind("选择", FlexiGridButtonType.Add).OnPress("Selected");
    })
)
<script type="text/javascript">
    function Selected() {
        if ($("#gridList").getSelectedRows().length == 0) {
            alert("请选择一条记录");
        }
        var date = $("#gridList").getSelectedRows();
        CloseModalDialog(null, true, date);
    }
</script>
